﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AutoMapper;
using Himall.Entity;

namespace Himall.Application.Mappers.Profiles
{
	public class ProductProfile:Profile
	{
		protected override void Configure()
		{
			base.Configure();

			CreateMap<ProductInfo, DTO.Product.Product>();
			CreateMap<DTO.Product.Product, ProductInfo>();

			CreateMap<ProductAttributeInfo, DTO.ProductAttribute>();
			CreateMap<DTO.ProductAttribute, ProductAttributeInfo>();

			CreateMap<ProductDescriptionInfo, DTO.ProductDescription>();
			CreateMap<DTO.ProductDescription, ProductDescriptionInfo>();

			CreateMap<SKUInfo, DTO.SKU>();
			CreateMap<DTO.SKU, SKUInfo>();

			CreateMap<SpecificationValueInfo, DTO.SpecificationValue>();
			CreateMap<DTO.SpecificationValue, SpecificationValueInfo>();

			CreateMap<ProductTypeInfo, DTO.ProductType>();
			CreateMap<DTO.ProductType, ProductTypeInfo>();

			CreateMap<BrandInfo, DTO.Brand>();
			CreateMap<DTO.Brand, BrandInfo>();

			CreateMap<ShopBrandApplysInfo, DTO.ShopBrandApply>();
			CreateMap<DTO.ShopBrandApply, ShopBrandApplysInfo>();

			CreateMap<ProductCommentsImagesInfo, DTO.ProductCommentImage>();
			CreateMap<DTO.ProductCommentImage, ProductCommentsImagesInfo>();

			CreateMap<ProductCommentInfo, DTO.ProductComment>().ForMember(p => p.Images, config => config.MapFrom(p => p.Himall_ProductCommentsImages));
			CreateMap<DTO.ProductComment, ProductCommentInfo>().ForMember(p => p.Himall_ProductCommentsImages, config => config.MapFrom(p => p.Images));

			CreateMap<ProductRelationProductInfo, DTO.ProductRelationProduct>();
			CreateMap<DTO.ProductRelationProduct, ProductRelationProductInfo>();

			CreateMap<SellerSpecificationValueInfo, DTO.SellerSpecificationValue>();
			CreateMap<DTO.SellerSpecificationValue, SellerSpecificationValueInfo>();

			CreateMap<ProductDescriptionInfo, DTO.ProductDescription>();
			CreateMap<DTO.ProductDescription, ProductDescriptionInfo>();

			CreateMap<ProductDescriptionTemplateInfo, DTO.ProductDescriptionTemplate>();
			CreateMap<DTO.ProductDescriptionTemplate, ProductDescriptionTemplateInfo>();

			CreateMap<ShopCategoryInfo, DTO.ShopCategory>();
			CreateMap<DTO.ShopCategory, ShopCategoryInfo>();

			CreateMap<ProductShopCategoryInfo, DTO.ProductShopCategory>();
			CreateMap<DTO.ProductShopCategory, ProductShopCategoryInfo>();
		}
	}
}
